package com.wjc.service;

import com.wjc.dao.UserMapper;
import com.wjc.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;

public class UserServiceImpl implements  UserService{

    @Autowired
    private UserMapper userMapper;

    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @Override
    public User checkLogin(String username, String password) {
        //判断
        User user = userMapper.checkLogin(username, password);
        if(user!=null&&user.getUsername().equals(username)&&user.getPassword().equals(password))
        {return user;}
        return null;
    }


    @Override
    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public int forgetUser(User user) {
        return userMapper.forgetUser(user);

    }
}
